package com.xbh.management.task.impl;

import com.xbh.management.model.ManUser;
import com.xbh.management.task.SuperExport;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * @program: management-center
 * @description:
 * @author: 许宝华
 * @create: 2021-09-27 14:08
 */


@Component
@Scope("prototype")//多实例，IOC容器启动创建的时候，并不会创建对象放在容器在容器当中，当你需要的时候，需要从容器当中取该对象的时候，就会创建。
public class UserExportImpl extends SuperExport<ManUser> {

    @Override
    protected void handle(SXSSFRow dateRow, Integer i, CellStyle style) {
        ManUser user = list.get(i);

        createCell(dateRow,0, i.toString(),style);
        createCell(dateRow,1, user.getUsername(),style);
        createCell(dateRow,2, user.getCreateTime().toString(),style);
        createCell(dateRow,3, user.getPersonName(),style);
        createCell(dateRow,4, user.getTelephone(),style);
        createCell(dateRow,5, user.getEmail(),style);
        createCell(dateRow,6, user.getBirthday().toString(),style);
        createCell(dateRow,7, user.getDescription(),style);
        createCell(dateRow,8, user.getStates()==0?"可用":"不可用",style);
    }
}
